const { defineConfig } = require('@vue/cli-service')
const { name } = require('./package');
console.log(process.env.NODE_ENV)
module.exports = defineConfig({
  transpileDependencies: true,
  devServer: {
    port: 3009,
    headers: {
      'Access-Control-Allow-Origin': '*',
    },
  },
  outputDir : process.env.NODE_ENV === 'production' ? name: 'dist',
  //! 相关资源的导入路径 千万要注意
  publicPath: process.env.NODE_ENV === 'production' ? `/child/${name}/` : '/',
  configureWebpack: {
    output: {
      library: `${name}-[name]`,
      libraryTarget: 'umd', // 把微应用打包成 umd 库格式
      chunkLoadingGlobal: `webpackJsonp_${name}`,
      globalObject: 'window'
    }
  }
})
